package com.liu.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Random;
import java.util.UUID;

@RestController
public class NginxContreller {


  @GetMapping("/page/login")
    public String getlogin(){
      return "helloword";
  }

  @GetMapping("/page/index")
  public String getindex(){
    return "index";
  }


  @GetMapping("/login")
  public  String login(HttpServletRequest request, HttpServletResponse response){

    Cookie cookie = new Cookie("userTike", UUID.randomUUID().toString());
    cookie.setPath("/");
    response.addCookie(cookie);

    return "main";

  }




}
